package main

import (
	"log"
	"net"

	"github.com/treelab/updatecolumn/config"
	"github.com/treelab/updatecolumn/handler"
	pb "github.com/treelab/updatecolumn/protos"
	"google.golang.org/grpc"
)

// server is used to implement updatecolumn.ColumnServer.

func main() {
	lis, err := net.Listen("tcp", config.Cfg.Host)
	if err != nil {
		log.Fatalf("failed to listen: %v", err)
	}
	s := grpc.NewServer()
	//Register handler
	pb.RegisterColumnServer(s, &handler.Server{})
	if err := s.Serve(lis); err != nil {
		log.Fatalf("failed to serve: %v", err)
	}
}
